Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-onclickoutside

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-onclickoutside

An onClickOutside mixin for React components

  • 0.3.4
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is react-onclickoutside?

The react-onclickoutside npm package is a React component wrapper that provides functionality to detect clicks outside of the component it wraps. It is commonly used to handle scenarios like closing dropdown menus, modals, or any floating elements when a user clicks outside of these components.

What are react-onclickoutside's main functionalities?

Detecting clicks outside a component

This feature allows you to wrap any React component with the react-onclickoutside higher-order component (HOC) to detect and handle clicks outside of it. In the code sample, `MyComponent` is wrapped with `onClickOutside`, enabling it to handle clicks that occur outside of its bounds.

import React, { Component } from 'react';
import onClickOutside from 'react-onclickoutside';

class MyComponent extends Component {
  handleClickOutside = evt => {
    // handle click outside logic here
  };

  render() {
    return <div>My Component</div>;
  }
}

export default onClickOutside(MyComponent);

Other packages similar to react-onclickoutside

Keywords

FAQs

Package last updated on 13 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc